<?php
/**
 * Created by PhpStorm.
 * User: 82508
 * Date: 2017/12/8
 * Time: 22:20
 */

@header("Content-type: text/html; charset=utf-8");


//链接数据库
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = 'root';
$link = mysqli_connect($dbhost, $dbuser, $dbpass, "login0");

//获取页面表单
$fname=$_POST["fname"];
$pwdL=$_POST["pwdL"];
if ($link) {
    mysqli_query($link, "set names utf8");
    $pwdL = md5($pwdL);
    $sql2 = "select * from user where username='{$fname}'and  pwd='{$pwdL}'";
    $re=mysqli_query($link, $sql2);
    $data = mysqli_fetch_assoc($re);

    if($data){
        echo "hi ".$fname." 登陆成功";
    }else{
        echo "用户名或者密码不正确";
    }


}


/*if (!$conn)
{
    echo "没有";
    die(mysql_error());
}

echo "成功";

$nameErr = $emailErr = "";
$name = $email =  "";

if ($_SERVER["REQUEST_METHOD"] == "POST") {
    if (empty($_POST["name"])) {
        $nameErr = "名字是必须的。";
    }else{
        $nameErr = "有名字?";

    }

}*/


?>